Skip to content

Conversation

@chrfranke
Copy link
Contributor

This is a retry of #1425.

Uses a different approach to let menu-complete only append a space if all alternatives allow this.

Copy link
Collaborator

@akinomyoga akinomyoga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I meant "Request changes".

@scop
Copy link
Owner

scop commented Oct 26, 2025

Just a note, I plan to release the next bash-completion version really soon, as soon as tomorrow (Oct 27). Would be nice to get this included in that release if we can get it merged in time (can also wait for a couple of more days if that's what it takes, but would rather not).

@chrfranke
Copy link
Contributor Author

Thanks for the info, will push a new version today.

@chrfranke
Copy link
Contributor Author

Done. Now always use _comp_compgen -P for prefixes, IMO easier to read.

Copy link
Collaborator

@akinomyoga akinomyoga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM basically.

# or similar bash_completion functionality would be required.
fmt='raw{8,16,48,56,64},hex{48,56,64},raw24/raw{24,32}'
fmt+=',msec24hour32,{sec,min,halfmin}2hour,temp10x,tempminmax'
_comp_compgen -P "${cur%%,*}," -- -W '{'"$fmt"'}{,\,,:}'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing three variations for all of the possible values (16x3 or 19x3) may be too much. It would be tedious to select one in menu-complete. What do you think about the idea of showing the three variations only when the candidate is unique?

Suggested change
_comp_compgen -P "${cur%%,*}," -- -W '{'"$fmt"'}{,\,,:}'
_comp_compgen -P "${cur%%,*}," -- -W '{'"$fmt"'}'
if ((${#COMPREPLY[@]} == 1)); then
_comp_compgen -R -- -W '"$COMPREPLY"{,\,,:}'
fi

If we adopt this, '{'"$fmt"'}' should be expanded in the actual code.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes plenty of sense && done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants